//
//  FSSpecialTopicHomePageHeaderView.m
//  fanshu
//
//  Created by 许海峰 on 16/4/30.
//  Copyright © 2016年 FS. All rights reserved.
//

#import "FSSpecialTopicHomePageHeaderView.h"

@implementation FSSpecialTopicHomePageHeaderView
- (instancetype) initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        self.frame = CGRectMake(0, 0, ScreenWidth, 90);
        self.backgroundColor = [UIColor whiteColor];
        //头像
        UIImageView *iconView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 40, 40)];
        iconView.image = [UIImage imageNamed:@"icon_publish_share_weibo"];
        [self addSubview:iconView];
        //名称
        UILabel *nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(60, 10, ScreenWidth - 60, 15)];
        nameLabel.text = @"程序猿";
        [self addSubview:nameLabel];
        //创建者
        UIButton * builderBtn = [UIButton buttonWithType:UIButtonTypeSystem];
        [builderBtn setTitle:@"简书" forState:UIControlStateNormal];
        [builderBtn setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
        builderBtn.titleLabel.font = [UIFont systemFontOfSize:12];
        builderBtn.x = 60;
        builderBtn.y = 25;
        [builderBtn sizeToFit];
        [self addSubview:builderBtn];
//        builderBtn.backgroundColor = [UIColor redColor];
        //关注数,文章数
        UILabel *countLabel = [[UILabel alloc] init];
        countLabel.x = CGRectGetMaxX(builderBtn.frame);
        countLabel.y = 32;
        countLabel.font = [UIFont systemFontOfSize:12];
        countLabel.text = @"1243764关注.988678文章";
        [countLabel sizeToFit];
        [self addSubview:countLabel];
        //投稿按钮
        UIButton * submitBtn = [UIButton buttonWithType:UIButtonTypeSystem];
        [submitBtn setImage:[UIImage imageNamed:@"button_submit_green"] forState:UIControlStateNormal];
        [submitBtn setBackgroundImage:[UIImage imageNamed:@"button_green_lined"] forState:UIControlStateNormal];
        [submitBtn setTitle:@"投稿" forState:UIControlStateNormal];
        [submitBtn setTitleColor:[UIColor greenColor] forState:UIControlStateNormal];
        submitBtn.titleLabel.font = [UIFont systemFontOfSize:12];
        submitBtn.frame = CGRectMake(60, 60, 50, 20);
        [self addSubview:submitBtn];
        [submitBtn addTarget:self action:@selector(submitBtnClick) forControlEvents:UIControlEventTouchUpInside];
        //分隔线
        UIView *lineView = [[UIView alloc] initWithFrame:CGRectMake(0, self.height -0.5, self.width, 0.5)];
        lineView.backgroundColor = [UIColor lightGrayColor];
        [self addSubview:lineView];
    }
    return self;
}
-(void)submitBtnClick {
    NSLog(@"submitBtnClick");
}
@end
